package io;

import java.util.Scanner;

/**
 * Created by pc on 2015/2/3.
 */
public class ScannerTest {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("\n");
        System.out.println("input a integer:");
        while (sc.hasNextLine()) {
            String input = sc.nextLine();
            if (input.equals("end")) return;
            try {
                long num = Long.parseLong(input);
//                int num = Integer.parseInt(input);
                System.out.println("just entererd number: " + num);
            } catch (Exception err) {
                System.out.println("not a number!" + input);
            }
            System.out.println("please input a integer:");
        }

    }
}
